public class Question {
    private String questionContent; 
    private boolean used; //holds the status showing whether the question is used
    private Choice[] choices;
    private int correctChoiceIndex = -1;//holds the the index of the Choice object which is the answer in the choices array.
    private boolean imageQuestion;
    
    public Question(String questionContent, Choice[] choices){
        this.questionContent = questionContent;
        this.choices = choices;
        this.used = false;
        for(int i=0; i<choices.length; i++)
            if(choices[i].isAnswer())
                correctChoiceIndex = i;
        if(choices[0] instanceof ImageChoice){
	        imageQuestion = true;
        }
    }
    
    public Question(String questionContent, String[] choicesContent){
        this.questionContent = questionContent;
        this.choices = new Choice[choicesContent.length];
        this.used = false;
        for(int i=0; i<choices.length; i++)
			choices[i] = new Choice(choicesContent[i]);
        /**If the first one is answer**/
        choices[0].setAnswer(true);
        correctChoiceIndex = 0;
        
        if(choices[0] instanceof ImageChoice){
	        imageQuestion = true;
        }
    }

    public Choice[] getChoices() {
        return choices;
    }

    public void setChoices(Choice[] choices) {
        this.choices = choices;
    }

    public int getCorrectChoiceIndex() {
        return correctChoiceIndex;
    }

    public void setCorrectChoiceIndex(int correctChoiceIndex) {
        this.correctChoiceIndex = correctChoiceIndex;
    }

    public String getQuestionContent() {
        return questionContent;
    }

    public void setQuestionContent(String questionContent) {
        this.questionContent = questionContent;
    }

    public boolean isUsed() {
        return used;
    }

    public void setUsed(boolean used) {
        this.used = used;
    }

    public void setImageQuestion(boolean imageQuestion){
	this.imageQuestion = imageQuestion;
    }

    public boolean isImageQuestion(){
	return imageQuestion;
    }
    
    /*
     * Function takes no prarmeter.
     * Function returns a Choice object which is an answer choices.
     */
    public Choice getCorrectChoice(){
	    return choices[correctChoiceIndex];
	}
	
    /*
     * Function takes no prarmeter.
     * Function erase two choices by updating the corresponding states of the choices.
     */
     public void halveTheChoices(){
	     if(imageQuestion){
		     
	     }else{
		     
	     }
     }
	
}
